package com.lc.stock.module.crawldata;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Duration;
import java.time.LocalDateTime;

/**
 * @author lichen
 * @description
 * @menu
 * @date 2023/2/9 8:52
 */
public abstract class AbstractCrawData implements ICrawData{

    //日志类
    private static final Logger log = LoggerFactory.getLogger(AbstractCrawData.class);

    @Override
    public void craw(String stockCode){
        LocalDateTime startTime = LocalDateTime.now();

        doCraw(stockCode);

        LocalDateTime endTime = LocalDateTime.now();
        Duration duration = Duration.between(startTime,endTime);
        long l = duration.toMillis();
        String subClassName = getSubClassName();
        log.info(stockCode + ": " + subClassName + "执行时间 = " + l);
    }

    public abstract void doCraw(String stockCode);

}
